Manager: Memory Manager



Carbon supports the majority of the Memory Manager programming interface. Changes primarily affect applications that use zones, system memory, or temporary memory. For example, temporary memory allocations in Mac OS X are allocated in the application's address space. As a result, calling TempNewHandle is effectively the same as calling NewHandle.

Carbon does not support current functions for accessing the system heap, but on OS X, you can use the POSIX shared memory APIs to achieve this functionality. In addition, the virtual memory system in Mac OS X introduces a number of changes in the addressing model.

By adhering to the following guidelines, you can increase your application's compliance with Mac OS X memory management:

* Try to use memory only within your own application heap. Review the places where you allocate memory in the system heap.

* Do not pass pointers to data among applications through Apple events, Gestalt routines, or other means. For example, don't share Toolbox data structures between applications, because in Mac OS X, each application will run in its own protected address space.

* Do not use inline, hard-coded addresses.

* Do not modify the zone header by calling the MoreMasters function. You should instead call the function MoreMasterPointers. Note, however, that master pointer blocks do not need to be preallocated or optimized in the Mac OS X environment, so MoreMasterPointers will only benefit Carbon applications running on Mac OS 8.

* Don't make assumptions about the layout of memory, such as the relative position of data stored in heaps, stacks, and other memory areas.

* Don't use the DisposePtr or DisposeHandle functions on pointers or handles allocated by Toolbox managers. For example, don't call the function DisposeHandle on a control allocated by the NewControl function; use DisposeControl instead.

* Because Mac OS X applications run in a large, protected memory space, memory sizing routines such as MaxMem and FreeMem work differently than before.

Unsupported  ApplicationZone

Not available in Carbon.

Supported  BlockMove

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  BlockMoveData

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  BlockMoveDataUncached

Available in Carbon 1.0.2 and later when running Mac OS 8.5 or later.

Supported  BlockMoveUncached

Available in Carbon 1.0.2 and later when running Mac OS 8.5 or later.

Supported  BlockZero

Available in Carbon 1.0.2 and later when running Mac OS 8.5 or later.

Supported  BlockZeroUncached

Available in Carbon 1.0.2 and later when running Mac OS 8.5 or later.

Supported  CallGrowZoneProc

Supported  CallPurgeProc

Supported  CallUserFnProc

Supported  CheckAllHeaps

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  CompactMem

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  CompactMemSys

Operations on the system heap are not allowed. Not available in Carbon.

Unsupported  DebuggerEnter

Not available in Carbon.

Unsupported  DebuggerExit

Not available in Carbon.

Unsupported  DebuggerGetMax

Not available in Carbon.

Unsupported  DebuggerLockMemory

Not available in Carbon.

Unsupported  DebuggerPoll

Not available in Carbon.

Unsupported  DebuggerUnlockMemory

Not available in Carbon.

Unsupported  DeferUserFn

Not available in Carbon.

Supported  DisposeGrowZoneUPP

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  DisposeHandle

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  DisposePtr

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  DisposePurgeUPP

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  DisposeUserFnUPP

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  EmptyHandle

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  EnterSupervisorMode

Not available in Carbon.

Supported  FlushMemory

Available in Carbon 1.0.2 and later when running Mac OS 8.5 or later.

Supported  FreeMem

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  FreeMemSys

Operations on the system heap are not allowed in Carbon. Not available in Carbon.

Unsupported  GetApplLimit

Not available in Carbon.

Supported  GetGrowZone

Available in Carbon 1.1 and later when CarbonLib 1.1 or later is present.

Supported  GetHandleSize

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  GetPageState

Not available in Carbon.

Unsupported  GetPhysical

Not available in Carbon.

Supported  GetPtrSize

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  GetVolumeVirtualMemoryInfo

Not available in Carbon.

Unsupported  GetZone

Not available in Carbon.

Supported  GrowZoneProcPtr

Supported  GZSaveHnd

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  HandAndHand

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  HandleZone

Not available in Carbon.

Supported  HandToHand

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  HClrRBit

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  HGetState

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  HLock

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  HLockHi

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  HNoPurge

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  HoldMemory

Available in Carbon 1.1 and later when running Mac OS 8.6 or later.

Supported  HPurge

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  HSetRBit

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  HSetState

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  HUnlock

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  InitApplZone

Not available in Carbon.

Unsupported  InitZone

Not available in Carbon.

Unsupported  InlineGetHandleSize

Used by 68K code. Not available in Carbon.

Supported  InvokeGrowZoneUPP

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  InvokePurgeUPP

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  InvokeUserFnUPP

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  IsHandleValid

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  IsHeapValid

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  IsPointerValid

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  LockMemory

Not available in Carbon.

Unsupported  LockMemoryContiguous

Not available in Carbon.

Unsupported  LockMemoryForOutput

Not available in Carbon.

Supported  MakeMemoryNonResident

Available in Carbon 1.0.2 and later when running Mac OS 8.5 or later.

Supported  MakeMemoryResident

Available in Carbon 1.0.2 and later when running Mac OS 8.5 or later.

Unsupported  MaxApplZone

This routine is not needed by PowerPC-based applications because they can specify a stack size in the cfrg resource. Not available in Carbon.

Supported  MaxBlock

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  MaxBlockSys

Not available in Carbon.

Supported  MaxMem

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  MaxMemSys

Not available in Carbon.

Supported  MemError

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  MoreMasterPointers

Carbon applications should use this function instead of MoreMasters to allocate a nonrelocatable block of master pointers in the current heap zone. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Not Recommended  MoreMasters

You should instead use MoreMasterPointers. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  MoveHHi

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  NewEmptyHandle

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  NewEmptyHandleSys

Not available in Carbon.

Supported  NewGrowZoneUPP

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  NewHandle

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  NewHandleClear

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  NewHandleSys

Not available in Carbon.

Unsupported  NewHandleSysClear

Not available in Carbon.

Supported  NewPtr

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  NewPtrClear

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  NewPtrSys

Not available in Carbon.

Unsupported  NewPtrSysClear

Not available in Carbon.

Supported  NewPurgeUPP

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  NewUserFnUPP

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  PageFaultFatal

Not available in Carbon.

Supported  PtrAndHand

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  PtrToHand

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  PtrToXHand

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  PtrZone

Not available in Carbon.

Supported  PurgeMem

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  PurgeMemSys

Not available in Carbon.

Supported  PurgeProcPtr

Supported  PurgeSpace

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  PurgeSpaceContiguous

Available in Carbon 1.0.2 and later when running Mac OS 8.5 or later.

Unsupported  PurgeSpaceSysContiguous

Not available in Carbon.

Unsupported  PurgeSpaceSysTotal

Not available in Carbon.

Supported  PurgeSpaceTotal

Available in Carbon 1.0.2 and later when running Mac OS 8.5 or later.

Supported  ReallocateHandle

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  ReallocateHandleSys

Not available in Carbon.

Supported  RecoverHandle

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  RecoverHandleSys

Not available in Carbon.

Supported  ReleaseMemoryData

Available in Carbon 1.0.2 and later when running Mac OS 8.5 or later.

Supported  ReserveMem

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  ReserveMemSys

Not available in Carbon.

Unsupported  SetApplBase

Not available in Carbon.

Unsupported  SetApplLimit

Not available in Carbon.

Supported  SetGrowZone

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  SetHandleSize

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  SetPtrSize

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  SetZone

Not available in Carbon.

Supported  StackSpace

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  StripAddress

There will be no 24-bit memory mode in Mac OS X, so there will be no 24-bit addresses to strip.

Unsupported  SystemZone

Not available in Carbon.

Supported  TempDisposeHandle

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  TempFreeMem

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  TempHLock

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  TempHUnlock

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  TempMaxMem

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  TempNewHandle

Temporary memory allocations will actually come from the applications's address space in Mac OS X. However, Carbon applications running under Mac OS 8.x will be able to get true temporary memory. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  TempTopMem

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Supported  TopMem

Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.

Unsupported  Translate24To32

There will be no 24-bit memory mode in Mac OS X, so there is no need to translate from 24- to 32-bit addresses.

Supported  UnholdMemory

Available in Carbon 1.1 and later when running Mac OS 8.6 or later.

Unsupported  UnlockMemory

Not available in Carbon.

Supported  UserFnProcPtr

[Table of Contents] [Manager Index] [Function Index]

Generated on: 8/1/2000. Copyright © 1999, 2000 Apple Computer, Inc. All rights reserved.